import java.lang.reflect.Proxy;

public class LogTest {
    public static void main(String[] args) {
        LogService logService = new LogServiceImpl();

        LogService proxyInstance = (LogService) Proxy.newProxyInstance(
                logService.getClass().getClassLoader(),
                logService.getClass().getInterfaces(),
                new LoggingInvocationHandler(logService)
        );

        proxyInstance.testMethod1();
        proxyInstance.testMethod2();
        proxyInstance.testMethod3();
    }
}
